from prod.models import GoodsModel
from haystack import indexes


# 创建一个索引类
class GoodsIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)

    def get_model(self):  # 必须
        return GoodsModel

    def index_queryset(self, using=None):
        """Used when the entire index for model is updated."""
        print("66666", self.get_model().objects.all())
        return self.get_model().objects.all()
